package com.dao.hm;

import java.util.List;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import com.entity.Offerdetail;

public interface OfferdetailDAO extends CrudRepository<Offerdetail, Long>,JpaSpecificationExecutor<Offerdetail>{
	@Query("from Offerdetail o where o.offerinfo.oiid=?1")
	public List<Offerdetail> queryByIIID(Long id);
	
	@Query("from Offerdetail o where o.logic=1")
	public Page<Offerdetail> queryNoCriteria(Pageable p);
	
	@Query("from Offerdetail o where o.logic=1 and o.product.name=?1")
	public Page<Offerdetail> queryByProductName(String name,Pageable p);

}
